/*Copyright (C) 2013-2022 LZE*/
#include<bits/stdc++.h>
#define fo(x) freopen(#x".in", "r", stdin); freopen(#x".out", "w", stdout);
#define INF 0x7fffffff
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 5000010;
const int M = 100010;
ll T, n, m, p;
ll inv[N];
int main() {
    inv[1] = 1;
    scanf("%lld%lld", &n, &p);
    for (ll i = 2; i <= n; i++) inv[i] = -(p / i) * inv[p % i] % p, inv[i] = (inv[i] + p) % p;
    for (ll i = 1; i <= n; i++) printf("%lld\n", inv[i]);
    return 0;
}